<!--{template /module/admin/view/head}-->
<div id="left_layout">
	<div id="main_content" class="container-fluid">
		<!--{template /module/admin/view/head_nav}-->
		<div class="row-fluid">
			<form method="post" action="{$ADMIN_SCRIPT}/user/{$dispatches[method]}&id={$_var[gp_id]}&page={$_var[page]}&psize={$_var[psize]}{$search[querystring]}" onsubmit="javascript:return check_form(this);">
			<input type="hidden" name="formsubmit" value="yes" />
			<div class="well widget">
				<div class="widget-header">
					<p class="text">* {lang admin.validate.require}</p>
				</div>
				<div class="widget-content">
				<fieldset>
					<label>{lang user.index_edit.view.username.label} *</label>
					<input type="text" class="input-xlarge" name="txtUserName" placeholder="{lang user.index_edit.view.username.placeholder}" maxlength="30" value="{$user[USERNAME]}"/> 
					<span class="help-inline">{lang user.index_edit.view.username.tips}</span>
					
					<label>{lang user.index_edit.view.email.label}</label>
					<input type="text" class="input-xlarge" name="txtEmail" placeholder="{lang user.index_edit.view.email.placeholder}" maxlength="100" value="{$user[EMAIL]}"/> 
					<span class="help-inline">{lang user.index_edit.view.email.tips}</span>
					
					<label>{lang user.index_edit.view.password.label} *</label>
					<input type="text" class="input-xlarge" name="txtPassword" value="" placeholder="{lang user.index_edit.view.password.placeholder}" maxlength="30"/> 
					<!--{if $dispatches['method'] == '_update'}--><span class="help-inline">{lang user.index_edit.view.password.upadte.span}</span><!--{/if}-->
					<!--{if $dispatches['method'] == '_add'}--><span class="help-inline">{lang user.index_edit.view.password.add.span}</span><!--{/if}-->
					
					<label>{lang user.index_edit.view.realname.label}</label>
					<input type="text" class="input-xlarge" name="txtRealName" placeholder="{lang user.index_edit.view.realname.placeholder}" maxlength="30" value="{$user[REALNAME]}"/> 
					
					<!--{if count($groups) > 0}-->
					<label>{lang user.index_edit.view.group.label} *</label>
					<select name="sltGroup">
	            		<option value="0">{lang user.index_edit.view.group.select.0}</option>
	            		<!--{loop $groups $group}-->
	            		<option value="{$group[GROUPID]}" {if $user['GROUPID'] == $group['GROUPID']}selected="selected"{/if}>{$group[CNAME]}</option>
	            		<!--{/loop}-->
	            	</select>
	            	<span class="help-inline">{lang user.index_edit.view.group.tips}</span>
	            	<!--{/if}-->
	            	
	            	<label>{lang user.index_edit.view.moblie.label}</label>
					<input type="text" class="input"  name="txtMobile" placeholder="{lang user.index_edit.view.moblie.placeholder}" maxlength="30" value="{$user[MOBILE]}"/> 
					
					<label>{lang user.index_edit.view.phone.label}</label>
					<input type="text" class="input"  name="txtPhone" placeholder="{lang user.index_edit.view.phone.placeholder}" maxlength="30" value="{$user[PHONE]}"/> 
					
					<label>{lang user.index_edit.view.comment.label}</label>
					<textarea class="span6" rows="3" cols="45" name="txtComment">{$user[COMMENT]}</textarea>
					<span class="help-inline">{lang user.index_edit.view.comment.tips}</span>
					
					<hr />
					<!--{if $dispatches['method'] == '_add'}-->
					<button type="submit"  name="btnSubmit" class="btn btn-small btn-primary" {$dispatches[operations][add]}>{lang admin.operation.submit}</button>
					<!--{elseif $dispatches['method'] == '_update'}-->
					<button type="submit"  name="btnSubmit" class="btn btn-small btn-primary" {$dispatches[operations][edit]}>{lang admin.operation.submit}</button>
					<!--{/if}-->
					<button type="reset" class="btn btn-small">{lang admin.operation.reset}</button>
					<button type="button" class="btn btn-small" onclick="javascript:location.href='{$ADMIN_SCRIPT}/user&page={$_var[page]}&psize={$_var[psize]}{$search[querystring]}';">{lang admin.operation.go.back}</button>
				</fieldset>
				</div>
			</div>
			</form>
		</div>
	</div>
</div>

<script>
function check_form(frm) {
	if (frm.txtUserName.value.trim().length == 0) {
		$(frm.txtUserName).next('.help-inline').css('color', 'red');
		frm.txtUserName.focus();
		return false;
	}
	
	if (frm.txtPassword.value.trim().length > 0) {
		if (!frm.txtPassword.value.isAnsi()) {
			$(frm.txtPassword).next('.help-inline').css('color', 'red');
			frm.txtPassword.focus();
			return false;
		}
	}
	
	{if count($groups) > 0}
	if (frm.sltGroup.selectedIndex < 1) {
		$(frm.sltGroup).next('.help-inline').css('color', 'red');
		frm.sltGroup.focus();
		return false;
	}
	{/if}
	
	{if !$third}
	if (frm.txtEmail.value.length == 0 && frm.txtMobile.value.length == 0) {
		$(frm.txtEmail).next('.help-inline').css('color', 'red');
		frm.txtEmail.focus();
		return false;
	}
	{/if}

	return true;
}

$(function() {
	$('.fancy').uniform();

	$('fieldset input,textarea,select').blur(function() {
		$(this).next('.help-inline').css('color', '#333');
	});
});
</script>
<!--{template /module/admin/view/foot}-->